package com.jk.vehicle.mini.constant;

/**
 * 常用是否枚举
 */
public enum UserTypeEnum {
    /**
     * 否
     */
    MANAGER((byte)0, "管理员"),

    /**
     * 是
     */
    NORMAL((byte)1, "被分享人员");

    private Byte code;

    private String name;

    private UserTypeEnum(Byte code, String name) {
        this.code = code;
        this.name = name;
    }

    public Byte getCode() {
        return code;
    }

    public void setCode(Byte code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据CODE获取枚举实例
     * @param code 枚举编号
     * @return 枚举实例
     */
    public static UserTypeEnum getEnum(Byte code){
        for(UserTypeEnum animal: UserTypeEnum.values()){
            if(animal.code.equals(code)){
                return animal;
            }
        }
        return null;
    }
}
